// pages/component/submit-form/1/index.js
const d = [
    { label: '小程序', value: '5' },
    { label: 'React', value: '8' },
    { label: 'Flutter', value: '10' }
]
const multiArray = [
    [
        { label: '小程序', value: '5' },
        { label: 'React', value: '8' },
        { label: 'Flutter', value: '10' }
    ],
    [
        { label: '年', value: '50' },
        { label: '月', value: '80' },
        { label: '日', value: '100' }
    ]
]
Page({
    data: {
        formData: [
            { label:'用户', name:'user' },
            { label:'密码', name:'password', opt:{ password:true } },
            { label:'日期', name:'date', type:'date' },
            { label:'日期范围', name:[ 'startDate', 'endDate'], type:'date-range' },
            { label:'单选', name:'radio', type:'radio', value: 1, t:'number' },
            { label:'真假值', name:'switch', type:'switch', value: true, t:'bool' },
            { label:'真假值', name:'switch2', type:'switch', value: 1, t:'number', checkbox:true },

            { label:'多选', name:'checkbox-group', type:'checkbox-group', data: d, value:['5','8'], t: 'array', count: 3 },
            { label:'单项选择', name:'select', type:'select', value: '8',  data: d },
            { label:'多项选择', name:'mul', type:'select', data: multiArray, mul: true, value:['8', '100'] },
            { label:'备注', name:'mask', type:'textarea', height:500 },
            { slot:'slot' },
            { label:'自定义', slot:'my-slot' },
        ],
    },
    onSubmit({ detail }){
        console.log(detail)
    },
    onChange({ detail }){
        console.log(detail)
    }
})